<!DOCTYPE html>
<html>
<head>
    {% load bootstrap3 %}
    {% bootstrap_css %}
    {% bootstrap_javascript %}
    <meta charset="utf-8">
    <title>Event Manage Page</title>
</head>
<div style="float:right;">
    <a>嘿！{{ user }} 欢迎</a>
    <hr/>
</div>
<body role="document">
<!-- 导航栏 -->
<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
            <a class="navbar-brand" href="/event_manage/">Event Manage System</a>
        </div>
        <div id="navbar" class="collapse navbar-collapse">
            <ul class="nav navbar-nav">
                <li class="active"><a href="/event_manage/">发布会</a>
                <li>
                <li><a href="/guest_manage/">嘉宾</a>
                <li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li><a href="#">{{ user }}</a></li>
                <li><a href="/logout/">退出</a></li>
            </ul>
        </div>
    </div>
</nav>

<!-- 发布会搜索表单 -->
<div class="page-header" style="padding-top: 60px;">
    <div id="navbar" class="navbar-collapse collapse">
        <!-- method=get为HTTP请求方式，action=/search_name/为搜索请求路径 -->
        <form class="navbar-form" method="get" action="/search_name/">
            <div class="form-group">
                <!-- name=name为搜索输入框name的属性值 -->
                <input name="name" type="text" placeholder="名称" class="form-control">
            </div>
            <button type="submit" class="btn btn-success">搜索</button>
        </form>
    </div>
</div>

<!-- 发布会列表 -->
<div class="row" style="padding-top: 80px;">
    <div class="col-md-6">
        <table class="table table-striped">
            <thead>
            <tr>
                <th>id</th>
                <th>名称</th>
                <th>状态</th>
                <th>地址</th>
                <th>时间</th>
                <th>签到</th>
            </tr>
            </thead>
            <tbody>
            {% for event in events %}
                <tr>
                    <td>{{ event.id }}</td>
                    <td>{{ event.name }}</td>
                    <td>{{ event.status }}</td>
                    <td>{{ event.address }}</td>
                    <td>{{ event.start_time }}</td>
                    <td>
                        <!-- 增加签到跳转链接，target这个属性意味着要在新窗口打开链接 -->
                        <a href="/sign_index/{{ event.id }}/" target="_blank">签到</a>
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
</div>

<!-- 列表分页器 -->
<div class="pagination">
            <span class="step-links">
            {% if search_name %}
                {% if events.has_previous %}
                    <a href="?page={{ events.previous_page_number }}&realname={{ search_name }}">上一页</a>
                {% endif %}
                <span class="current">
                    Page {{ events.number }} of {{ events.paginator.num_pages }}.
                </span>
                {% if events.has_next %}
                    <a href="?page={{ events.next_page_number }}&realname={{ search_name }}">下一页</a>
                {% endif %}
            {% else %}
                {% if events.has_previous %}
                    <a href="?page={{ events.previous_page_number }}">上一页</a>
                {% endif %}
                <span class="current">
                    Page {{ events.number }} of {{ events.paginator.num_pages }}.
                </span>
                {% if events.has_next %}
                    <a href="?page={{ events.next_page_number }}">下一页</a>
                {% endif %}
            {% endif %}
            </span>
</div>
</body>
</html>